package br.ucb.rest.persistencia;

import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public final class HibernateUtil {
	
	private static HibernateUtil instance;
	private EntityManagerFactory factory;
	
	public static HibernateUtil getInstance() {
		if (instance == null) {
			instance = new HibernateUtil();
		}
		
		return instance;
	}
	
	public EntityManagerFactory getEntityManagerFactory() {
		if (factory == null) {
			factory = Persistence.createEntityManagerFactory("Restaurante");
		}
		return factory;
	}
}
